package com.leon.proxy.v01;

import java.util.Random;

/**
 * 无代理写法耦合度太高
 * 1.写完基础功能
 * 2.添加辅助功能
 * @author 史鸿禹
 * @date 2022/07/13  2:54 下午
 */
public class Person implements Action{


    @Override
    public void eat() {
        System.out.println("吃饭");
        try {
            Thread.sleep(new Random().nextInt(10000));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        Person person = new Person();
        long start = System.currentTimeMillis();
        person.eat();
        long end = System.currentTimeMillis();
        System.out.println("吃饭耗时:"+String.valueOf(end-start));
    }
}

interface Action{
    public void eat();
}
